//
//  BaseToolsKit.h
//  Pods
//
//  Created by zyming on 2022/8/10.
//

#ifndef BaseToolsKit_h
#define BaseToolsKit_h
///私有库
#import "BaseCategoryKit.h"
///本地
#import "AccountModel.h"
///设置mainDeviceType
#define SetMainDeviceType(s) [AccountModel setMainDeviceType:(s)]
///获取mainDeviceType
#define GetMainDeviceType [AccountModel getMainDeviceType]
///获取selectedDeviceType
#define GetSelectedDeviceType [DeviceModel getSelectDeviceType]
///获取当前选择的家人设备id
#define getSelectedDeviceCode   [DeviceModel getSelectDeviceCode]
///空白提示
#import "EmpyView.h"
#define ShowEmptyInViewAndDataArr(view,data) [EmpyView emptyViewInView:view andData:data]
#import "NSObject+HZCoding.h"
#import "SKArchCutter.h"
//获得udid
#import "UUIDUtil.h"
#define getUDID [UUIDUtil getUUID]

#import "NSBundle+BaseTookKit.h"
///国际化语音
#define GDBaselocalString(s) [[NSBundle GDBaseLanguageBundle] localizedStringForKey:s value:@"" table:@"GDBaseLocalizable"]
///图片
#define GDBaseImage(s) [NSBundle GDbaseImageForBundle:s]

#import "BaseNetworkManager.h"
#import "JQFMDB.h"

#pragma mark - 宏定义

//当前语言
#define kAppLanguage [[[NSUserDefaults standardUserDefaults] objectForKey:@"AppleLanguages"] firstObject]
//UserDefault
#define UserDefault     [NSUserDefaults standardUserDefaults]
///获取用户id
#define GetAccountId  [AccountModel getAccountInfo].accountId
///获取当前选择的用户 id
#define GetSelectAccountId  [AccountModel getSelectedAccountId]
///获取群组id
#define getMyUserGroup [UserDefault objectForKey:@"my_UserGroup"]
///保存群组id
#define setMyUserGroup(s) { [UserDefault setObject:(s) forKey:@"my_UserGroup"];\
[UserDefault synchronize];}
///获取当前设备id
#define getMyDeviceCode   [UserDefault objectForKey:@"my_DeviceCode"]
///保存当前设备id
#define setMyDeviceCode(s) { [UserDefault setObject:(s) forKey:@"my_DeviceCode"];\
[UserDefault synchronize];}



#define getAppleUserID [UserDefault objectForKey:@"my_AppleUserID"]
#define setAppleUserID(s) { [UserDefault setObject:(s) forKey:@"my_AppleUserID"];\
[UserDefault synchronize];}


///颜色
#define RGBFromHex(s) [UIColor colorWithRed:(((s & 0xFF0000) >> 16 )) / 255.0 green:((( s & 0xFF00 ) >> 8 )) / 255.0 blue:(( s & 0xFF )) / 255.0 alpha:1.0]
#define RGB(r,g,b)  [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:1.0]
#define MyAlphaColor(r, g, b, a) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:(a)]
#define RandColor RGB(arc4random_uniform(255), arc4random_uniform(255), arc4random_uniform(255))
#define MainColor  [AccountModel GetMainColor]
#define MyTitleTextColor        RGBFromHex(0x333333) // 标题字体颜色
#define MyDetailTextColor       RGBFromHex(0x999999) // 辅助字体颜色
#define myLineColor             RGBFromHex(0xDDDDDD) // 线的颜色
#define MyViewBgColor        RGBFromHex(0xF6F6FA)
#define myBGViewColor       RGBFromHex(0xF6F6FA)
#define Color_51   RGB(51,51,51)
#define Color_153  RGB(153,153,153)

#define WEAKSELF(self)  __weak __typeof(self) weakSelf = self
#define BLOCKSELF(self)  __block __typeof(self) weakSelf = self

//image
#define MOImage(ImageString) [UIImage imageNamed:ImageString]
//url
#define MOURL(URLString) [NSURL URLWithString:[NSString stringWithFormat:@"%@",URLString]]
//UserDefault
#define UserDefault         [NSUserDefaults standardUserDefaults]
//NotificationCenter
#define NotificationCenter  [NSNotificationCenter defaultCenter]

//关闭键盘
#define ShutDownEnding [[UIApplication sharedApplication] sendAction:@selector(resignFirstResponder) to:nil from:nil forEvent:nil]
//加粗
#define MOBold(label,number) [label setFont:[UIFont fontWithName:@"Helvetica-Bold" size:number]]
//自定义字体
#define CumstomFont(fontString,fontNumber) [UIFont fontWithName:fontString size:fontNumber];

//5 5s
#define isIPHONE5  (KSCREEN_height == 568.0)

//6   6s   7   8
#define IS_iPhone_6  ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(750, 1334), [[UIScreen mainScreen] currentMode].size) : NO)

//6s_plus  6_plus  7_plus  8_plus
#define IS_iPhone_6s_plus  ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1242, 2208), [[UIScreen mainScreen] currentMode].size) : NO)

// iPhoneX  iPhoneXS   11_pro
#define IS_iPhoneX ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2436), [[UIScreen mainScreen] currentMode].size) : NO)

//iPhone XS Max 11_pro_max
#define IS_iPhoneXs_max ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1242, 2688), [[UIScreen mainScreen] currentMode].size) : NO)

//iPhone 11
#define IS_iPhone11 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(828, 1792), [[UIScreen mainScreen] currentMode].size) : NO)

// iPhone XR
#define IS_iPhoneXR (KSCREEN_width == 375.0 && KSCREEN_height == 812)

//iPhone 12 mini
#define IS_iPhone12Mini ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1080, 2340), [[UIScreen mainScreen] currentMode].size) : NO)

//iPhone 12 iPhone 12 pro
#define IS_iPhone12_IS_iPhone12Pro ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1170, 2532), [[UIScreen mainScreen] currentMode].size) : NO)

//iPhone 12Max
#define IS_iPhone12Max ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1284, 2778), [[UIScreen mainScreen] currentMode].size) : NO)

//iPhone X系列
#define kIPhoneX ( ((IS_iPhoneX) || (IS_iPhoneXs_max ) || (IS_iPhone11) ||  (IS_iPhone12Mini) ||  (IS_iPhone12Max)  ||  (IS_iPhone12_IS_iPhone12Pro)  || (IS_iPhoneXR) ) ? YES : NO)


//window
#define KWINDOW [UIApplication sharedApplication].keyWindow
//设备屏宽
#define KSCREEN_width [UIScreen mainScreen].bounds.size.width
//设备屏高
#define KSCREEN_height [UIScreen mainScreen].bounds.size.height

#define Ratio  ([UIScreen mainScreen].bounds.size.height/667)
#define kScreenWidthRatio  (UIScreen.mainScreen.bounds.size.width / 375.0)
#define kScreenHeightRatio (UIScreen.mainScreen.bounds.size.height / 667.0)
#define AdaptedWidth(W)  ceilf((W) * kScreenWidthRatio)
#define AdaptedHeight(H) ceilf((H) * kScreenHeightRatio)
#define AdaptedFontSize(R)     [UIFont systemFontOfSize:AdaptedWidth(R)]

#define MyFitWith(s) (s * kScreenWidthRatio)
#define MyFitHeight(s) (s * kScreenHeightRatio)

#define BuildShadowMaskView(view,frame)  view.frame = frame;view.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.7f]; view.userInteractionEnabled = YES;

///顶部安全区高度
#define SafeAreaStatusBar_Height ([UIView vg_safeDistanceTop])
/// 顶部状态栏高度（包括安全区）
#define StatusBarHeight ([UIView vg_statusBarHeight])
/// 导航栏高度( 49.0 )
#define NavigationBarHeight ([UIView vg_navigationBarHeight])
///nav高度（包括安全区）
#define SafeAreaNavBarHeight ([UIView vg_navigationFullHeight])
///tabbar高度 底部导航栏高度（包括安全区）
#define SafeAreaTabbarHeight ([UIView vg_tabBarFullHeight])
///底部横条高度
#define SafeAreaTabbarDicatorHeight ([UIView vg_safeDistanceBottom])

//当前版本号
#define CurrentVersion [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]
//当前系统版本
#define CurrentOsversion [UIDevice currentDevice].systemVersion
///当前bundleid
#define CurrentBundleID   [[NSBundle mainBundle]bundleIdentifier]

#ifdef DEBUG
#define NSLog(FORMAT, ...) fprintf(stderr,"[%s:%d行] %s\n",[[[NSString stringWithUTF8String:__FILE__] lastPathComponent] UTF8String], __LINE__, [[NSString stringWithFormat:FORMAT, ##__VA_ARGS__] UTF8String]);
#else
#define NSLog(FORMAT, ...) nil
#endif


//苹方-简 细体
#define PingFang_SC_Light8          [UIFont fontWithName:@"PingFang-SC-Light" size:10]
#define PingFang_SC_Light9          [UIFont fontWithName:@"PingFang-SC-Light" size:11]
#define PingFang_SC_Light10         [UIFont fontWithName:@"PingFang-SC-Light" size:12]
#define PingFang_SC_Light11         [UIFont fontWithName:@"PingFang-SC-Light" size:13]
#define PingFang_SC_Light12         [UIFont fontWithName:@"PingFang-SC-Light" size:14]
#define PingFang_SC_Light13         [UIFont fontWithName:@"PingFang-SC-Light" size:15]
#define PingFang_SC_Light14         [UIFont fontWithName:@"PingFang-SC-Light" size:16]
#define PingFang_SC_Light15         [UIFont fontWithName:@"PingFang-SC-Light" size:17]
#define PingFang_SC_Light16         [UIFont fontWithName:@"PingFang-SC-Light" size:18]
#define PingFang_SC_Light17         [UIFont fontWithName:@"PingFang-SC-Light" size:18]
#define PingFang_SC_Light18         [UIFont fontWithName:@"PingFang-SC-Light" size:18]
#define PingFang_SC_Light19         [UIFont fontWithName:@"PingFang-SC-Light" size:19]
#define PingFang_SC_Light20         [UIFont fontWithName:@"PingFang-SC-Light" size:20]
#define PingFang_SC_Light21         [UIFont fontWithName:@"PingFang-SC-Light" size:21]
#define PingFang_SC_Light22         [UIFont fontWithName:@"PingFang-SC-Light" size:22]
#define PingFang_SC_Light24         [UIFont fontWithName:@"PingFang-SC-Light" size:24]
#define PingFang_SC_Light28         [UIFont fontWithName:@"PingFang-SC-Light" size:28]
#define PingFang_SC_Light30         [UIFont fontWithName:@"PingFang-SC-Light" size:30]
#define PingFang_SC_Light38         [UIFont fontWithName:@"PingFang-SC-Light" size:38]
#define PingFang_SC_Light40         [UIFont fontWithName:@"PingFang-SC-Light" size:40]
#define PingFang_SC_Light50         [UIFont fontWithName:@"PingFang-SC-Light" size:50]
#define PingFang_SC_Light56         [UIFont fontWithName:@"PingFang-SC-Light" size:56]
#define PingFang_SC_Light60         [UIFont fontWithName:@"PingFang-SC-Light" size:60]

#define Font8 [UIFont systemFontOfSize:8]
#define Font9 [UIFont systemFontOfSize:9]
#define Font10 [UIFont systemFontOfSize:10]
#define Font11 [UIFont systemFontOfSize:11]
#define Font12 [UIFont systemFontOfSize:12]
#define Font13 [UIFont systemFontOfSize:13]
#define Font14 [UIFont systemFontOfSize:14]
#define Font15 [UIFont systemFontOfSize:15]
#define Font16 [UIFont systemFontOfSize:16]
#define Font17 [UIFont systemFontOfSize:17]
#define Font18 [UIFont systemFontOfSize:18]
#define Font19 [UIFont systemFontOfSize:18]

#define RemoveAll(view) [view.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)];

#pragma mark - 第三方
#import "SVProgressHUD.h"
#import "SVProgressHUD+Extention.h"
#import "UIImageView+WebCache.h"
#import "MJExtension.h"
#import "Masonry.h"
#import "MJRefresh.h"
#import "HXPhotoManager.h"
#import "GDRemindTool.h"
#import "GDChoosePictureView.h"
#import "GDPhotoManager.h"
#import "UIButton+ActionBlock.h"
#import "GDLogViewController.h"
#import "GDLog.h"
#import "InfoBirthView.h"
#import "GDBaseViewController.h"


#endif /* BaseToolsKit_h */
